package Practice.classpractice;

import java.util.Locale;
import java.util.Scanner;
public class TestD {
    private boolean isLegal(char ch){//判断字符是否合法
        if(ch >= 'a' && ch <= 'z' || ch >= '0' && ch <= '9'){
            return true;
        }
        return false;
    }
    public boolean isPalindrome(String s) {
        s = s.toLowerCase();
        int left = 0;
        int right = s.length()-1;
        while(left < right){
            //判断字符是否合法，若不合法返回取非为true
            while(left < right && !isLegal(s.charAt(left))){
                left++;
            }
            while(left < right && !isLegal(s.charAt(right))){
                right--;
            }

            if(s.charAt(left) != s.charAt(right)){
                return false;
            }else{
                left++;
                right--;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        TestD testD = new TestD();

        System.out.println(testD.isPalindrome(s));
    }
}